package day04;

import java.util.Random;
import java.util.Scanner;

public class Day4 {
    public static void main(String[] args) {
        Random r = new Random();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入命令：1：注册，2：登录，3：退出");
        int command = sc.nextInt();
        switch (command){
            case 1:
                System.out.println("注册成功");
                break;
            case 2:
                System.out.println("登录成功");
                break;
            case 3:
                System.out.println("退出应用");
                break;
            default:
                System.out.println("输入错误");
                break;
        }
        int s =r.nextInt(100)+1;
        System.out.println("请输入猜数字：");
        while (true){
            int caiNumber = sc.nextInt();

            if (caiNumber>s){
                System.out.println("猜大了，继续猜");
            }else if (caiNumber<s){
                System.out.println("猜小了，继续猜");
            }else {
                System.out.println("恭喜！，猜对了，正确答案是："+s);
                break;
            }
        }

        for (int i = 0; i < 5; i++) {
            System.out.println("行动是成功的阶梯");
        }
        for (int i = 1; i <= 9; i++) {
            System.out.print(i+"*"+9+"="+i*9+" ");
        }
        System.out.println();


        System.out.println("请输入数值：");
        int num = sc.nextInt();
        if (num>0){
            System.out.println("是正数:+");
        }else if (num<0){
            System.out.println("是负数:-");
        }else {
            System.out.println("是0");
        }
        System.out.println("请输入年份:");
        int year = sc.nextInt();
        int day;
        System.out.println("请输入月份:");
        int month = sc.nextInt();
        if (year%4==0&&year%100!=0||year%400==0){
            day = 366;
            System.out.println("该年是闰年，有"+day+"天");

        }else {
            day = 365;
            System.out.println("该年是平年，有"+day+"天");
        }
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                month = 31;
                System.out.println("该月份有："+month+"天");
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                month = 30;
                System.out.println("该月份有："+month+"天");
                break;
            case 2:
                if (day==366){
                    month = 29;
                    System.out.println("该月份有："+month+"天");
                }else {
                    month = 28;
                    System.out.println("该月份有："+month+"天");
                }
                break;
            default:
                System.out.println("年份输入错误");
                break;


        }
        int number = 1;
        int all =0;
        while (number<=100){
            all+=number;
            number++;
        }
        System.out.println(all);
        int count = 0;
        for (int i = 1900; i <=2023 ; i++) {
            if (i%4==0&&i%100!=0||i%400==0){
                    System.out.print(i+" ");
                    count++;
                    if (count%10==0){
                        System.out.println();
                    }
            }
        }


    }
}
